#<Directory />
#	Options FollowSymLinks
#	AllowOverride None
#	Require all denied
#</Directory>

#<Directory /usr/share>
#	AllowOverride None
#	Require all granted
#</Directory>

#<Directory /var/www/>
#	Options Indexes FollowSymLinks
#	AllowOverride None
#	Require all granted
#</Directory>





COOPGISDirectory="/opt/coopgis/"
COOPGISConfigDirectory="/opt/coopconfig/"
COOPGISConfigFileName = "coopgisconfig.py"
PythonPath = COOPGISDirectory + "djangoproject/"


def AddLinesToConfigFile(ConfigFileName, LinesToAdd):
    print LinesToAdd
    ConfirmedLinesToAdd = []
    ConfigFileLines = []
    with open (ConfigFileName, 'r') as ConfigFile:
        ConfigFileLines = ConfigFile.readlines()
    StrippedConfigFileLines = []
    for line in ConfigFileLines:
        StrippedConfigFileLines.append(line.replace(' ', '').lower().strip())
    StrippedLinesToAdd = []
    for line in LinesToAdd:
        StrippedLinesToAdd.append(line.replace(' ', '').lower().strip())
    for i in range(0, len(LinesToAdd)):
        if(not StrippedLinesToAdd[i] in StrippedConfigFileLines):
            ConfirmedLinesToAdd.append(LinesToAdd[i])
    if(ConfirmedLinesToAdd):
        with open(ConfigFileName, 'w') as ConfigFile:
            for line in ConfigFileLines:
                ConfigFile.write(line)
            for line in ConfirmedLinesToAdd:
                if(not '\n' in line):
                    line = line + '\n'
                ConfigFile.write(line)
